package com.ssy.lingxi.logistics.model.enums;

import com.ssy.lingxi.common.language.LanguageHolder;
import com.ssy.lingxi.logistics.api.validate.IntArrayValuable;

import java.util.Arrays;

/**
 * 物流单外部状态枚举
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/14
 */
public enum LogisticsOrderStatusEnum implements IntArrayValuable {

    /**
     * 待提交 - 1
     */
    WAIT_SUBMIT(1, "待提交"),

    /**
     * 待确认 - 2
     */
    WAIT_CONFIRMED(2, "待确认"),

    /**
     * 不接受物流单 - 3
     */
    NO_RECEIVE(3, "不接受物流单"),

    /**
     * 接受物流单 - 4
     */
    RECEIVE(4, "接受物流单");


    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(LogisticsOrderStatusEnum::getCode).toArray();

    private Integer code;

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public static String getCodeMsg(Integer code) {
        return LanguageHolder.getName(LogisticsOrderStatusEnum.class, code);
    }

    LogisticsOrderStatusEnum(Integer code, String message) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

}
